#include <stdio.h>

int main(int argc, char const *argv[])
{
    int cache[1024], *read, *write, *p;
    int m, n, result = 0, i, r, isCached;
    scanf("%d%d", &m, &n);
    read=cache;
    write=cache;
    for (i = 0; i < n; i++)
    {
        scanf("%d",&r);
        p = read;
        isCached=0;
        
        while (p < write)
        {
            if (*p==r)
            {
                isCached=1;
                break;
            }
            p++;
        }
        if (!isCached)
        {
            result++;
            *write=r;
            write++;
            if (write-read>m)
            {
                read++;
            }
        }
    }
    
    printf("%d", result);
    return 0;
}
